//
// Created by blank on 2017/5/8.
// Copyright (c) 2017 CYN. All rights reserved.
//

#import "Employee.h"
#import "Manager.h"
#import "PrintNotification.h"


@implementation Employee {

}

+ (Employee *)instance {
    static Employee *_instance = nil;

    @synchronized (self) {
        if (_instance == nil) {
            _instance = [[self alloc] init];
        }
    }

    return _instance;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(doPrintJob)
                                                     name:NOTIF_BEGIN_PRINT_TASK
                                                   object:nil];
    }

    return self;
}


- (void)doPrintJob {
    NSLog(@"doing printing job");
//    [[Manager instance] celebratePringDone];

#if 0
    if ([_delegate respondsToSelector:@selector(printJobDone)]) {
        [_delegate printJobDone];
    }
#else
    [[NSNotificationCenter defaultCenter] postNotificationName:NOTIF_DONE_PRINT_TASK
                                                        object:nil];

#endif

}


@end